package collections;

import utils.PrintlnUtils;

import java.util.Stack;

/*
    https://blog.csdn.net/qq_51537858/article/details/127064577

    https://www.techiedelight.com/zh/iterate-through-stack-java/

    https://www.cnblogs.com/lvjingying/p/14015578.html
 */
public class TestStack {
    public static void main(String[] args) {
        Stack<Integer> integerStack = new Stack<>();
        integerStack.push(1);
        integerStack.push(2);
        integerStack.push(3);

        integerStack.stream().forEach(i ->{
            PrintlnUtils.println("栈顶出栈元素 : "+i);
        });

//        PrintlnUtils.println("integerStack size = "+integerStack.size()+" , 栈顶元素："+integerStack.peek());
//        PrintlnUtils.println("栈顶出栈元素："+integerStack.pop());
//        PrintlnUtils.println("integerStack size = "+integerStack.size()+" , 栈顶元素："+integerStack.peek());
        String str = "QCNLLAZI3agg";
        if (str.length() > 8){
            str = str.substring(str.length()-8, str.length());
        }
        PrintlnUtils.println("邀请码长度："+str.length()+" str = "+str);
        //邀请码长度：8 str = LAZI3agg
    }
}
